

public class Test {

    public static boolean isAdmin(String userId){
        return userId.toLowerCase()=="admin";
    }

    public static void main(String[] args) {
        System.out.println(isAdmin("Admin"));
    }


    public static void main3(String[] args) {

        StringBuffer stringBuffer = new StringBuffer("nihao");
        stringBuffer.append("mengjun");//考虑了线程的安全问题
        //append是将String类型的转化为StringBuffer类型的

        StringBuilder stringBulider = new StringBuilder("zaibu");
        stringBulider.append("zaia");//不考虑线程的安全问题

        String ret = stringBuffer.toString();
        //toString（）将StringBuffer转化为String类型的

        System.out.println(ret);


        /*StringBuilder stringBuilder = new StringBuilder("hello");
        stringBuilder.insert(1,"abc");//在下标为1的位置插入一个字符串"abc";
        stringBuilder.insert(1,3);//[1，3)左闭右开删除的是1下标和2下标的内容
        System.out.println("===============");
        */
    }
    public static void main2(String[] args) {
        String s = "hello";
        for(int i = 0; i < 1000; i++) {
            s +=i;
        }
        System.out.println(s);
    }

    public static void main1(String[] args) {
        /*String s = "hello";
        s += "world";
        System.out.println(s);
        System.out.println("================");*/ //相当于下面的代码
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("hello");
        stringBuilder.append("world");
        String ret = stringBuilder.toString();
        System.out.println(ret);
    }
}
